package com.bush.mall.product.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.product.entity.AttrAttrgroupRelationEntity;
import com.bush.mall.product.service.AttrAttrgroupRelationService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 属性&属性分组关联
 * @author RUN
 * @date 2022-11-28
 */
@RestController
@RequestMapping("attrattrgrouprelation")
@Api(tags = "属性&属性分组关联管理" )
public class AttrAttrgroupRelationController {

    @Resource(name= AttrAttrgroupRelationService.BEAN_ID)
    private AttrAttrgroupRelationService attrAttrgroupRelationService;

    /**
     * 分页查询属性&属性分组关联列表
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "分页查询属性&属性分组关联列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return attrAttrgroupRelationService.queryForPage(current,size);
    }

    /**
     * 保存属性&属性分组关联表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "保存属性&属性分组关联表单")
    @PostMapping("saveAttrAttrgroupRelation")
    public Result saveAttrAttrgroupRelation(@RequestBody AttrAttrgroupRelationEntity attrAttrgroupRelation){
        return attrAttrgroupRelationService.saveAttrAttrgroupRelation(attrAttrgroupRelation);
    }

    /**
     * 修改属性&属性分组关联表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "修改属性&属性分组关联表单")
    @PutMapping("updateAttrAttrgroupRelation")
    public Result updateAttrAttrgroupRelation(@RequestBody AttrAttrgroupRelationEntity attrAttrgroupRelation){
        return attrAttrgroupRelationService.updateAttrAttrgroupRelation(attrAttrgroupRelation);
    }

    /**
     * 通过指定id删除属性&属性分组关联
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "通过指定id删除属性&属性分组关联")
    @DeleteMapping("deleteAttrAttrgroupRelation")
    public Result deleteAttrAttrgroupRelation(Long id){
        return attrAttrgroupRelationService.deleteAttrAttrgroupRelation(id);
    }

}
